<?php
/**
 * Created by PhpStorm.
 * User: 安仔
 * Date: 2017/7/5
 * Time: 17:42
 */

namespace App\Http\Controllers\Resource;

use App\Busi\Modules\Captcha\ConsultCaptchaBusi;
use App\Busi\Modules\Captcha\ForgetPwdCaptchaBusi;
use App\Busi\Modules\Captcha\RegisterCaptchaBusi;
use App\Busi\Modules\Resource\BannerListBusi;
use App\Busi\Modules\Resource\CityListBusi;
use App\Busi\Modules\Resource\CompanyAddBusi;
use App\Busi\Modules\Resource\CompanyCaseAddBusi;
use App\Busi\Modules\Resource\CompanyCaseBusi;
use App\Busi\Modules\Resource\CompanyCaseDelBusi;
use App\Busi\Modules\Resource\CompanyCaseGetOneBusi;
use App\Busi\Modules\Resource\CompanyCaseListBusi;
use App\Busi\Modules\Resource\CompanyDetailBusi;
use App\Busi\Modules\Resource\CompanyListBusi;
use App\Busi\Modules\Resource\CompanyStaffAddBusi;
use App\Busi\Modules\Resource\CompanyStaffBusi;
use App\Busi\Modules\Resource\CompanyStaffDelBusi;
use App\Busi\Modules\Resource\CompanyStaffGetOneBusi;
use App\Busi\Modules\Resource\CompanyStaffListBusi;
use App\Busi\Modules\Resource\ConsultAddBusi;
use App\Busi\Modules\Resource\ConsultGetOneBusi;
use App\Busi\Modules\Resource\ConsultListBusi;
use App\Busi\Modules\Resource\DistAddBusi;
use App\Busi\Modules\Resource\HotNewsListBusi;
use App\Busi\Modules\Resource\ImgUploadBusi;
use App\Busi\Modules\Resource\IndexNewsBusi;
use App\Busi\Modules\Resource\NewsDetailBusi;
use App\Busi\Modules\Resource\NewsIndexBusi;
use App\Busi\Modules\Resource\NewsListBusi;
use App\Busi\Modules\Resource\PolicyListBusi;
use App\Busi\Modules\Resource\QuotaBusi;
use App\Busi\Modules\Resource\QuotaMutilBusi;
use App\Busi\Modules\Resource\RandNewsListBusi;
use App\Busi\Modules\Resource\StandardBusi;
use App\Busi\Modules\Resource\SubCategoryBusi;
use App\Busi\Modules\Resource\SubCategoryList;
use App\Busi\Modules\Resource\SupCategoryBusi;

use App\Busi\Modules\Resource\TestUploadBusi;
use App\Busi\Modules\Resource\ThridUrlListBusi;
use App\Busi\Modules\Resource\UploadCompanyInfoBusi;
use App\Busi\Modules\Resource\UserCompanyInfoBusi;
use App\Busi\Modules\Resource\UserInfoBusi;
use App\Busi\Modules\Resource\VoucherListBusi;
use App\Http\Controllers\Controller;

use App\Models\Dist;
use App\Models\SecQualifyCategory;
use Illuminate\Http\Request;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use phpDocumentor\Reflection\Types\Integer;

class ResourceController extends Controller
{
    


    function city(Request $request){
        $province_id = $request->q;
        $fields = ["id","dist_name as text"];
        $data = Dist::where("parent_id",$province_id)->select($fields)->get();
        $data = $data->toArray();
        array_push($data,["0"=>"无"]);
        return $data;
    }

    /**
     * 管理后台根据父级id获根据取资质子类目
     * @param Request $request
     * @return mixed
     */
    function admin_subcategory(Request $request){
        $parent_cate_id = $request->q;
        $fields = ["id","category_name as text"];
        $data = SecQualifyCategory::where("parent_cate_id",$parent_cate_id)->select($fields)->get();

//        $data = $data->toArray();
//        array_push($data,["0"=>"无"]);
        return $data;
    }
    function admin_level(Request $request){
        $category_id = $request->q;
        $where = [
            ["id","=",$category_id],
        ];
        $fileds = ["id","category_name"];
        $data = SecQualifyCategory::where($where)->select($fileds)->orderBy("show_order","asc")->get();
        foreach ($data as &$item){
            $levels = $item->levels;
            $level_array = [];

            $item["levels"] = $this->getLevelsByCateIdFromQuota($item["id"]);
            foreach ($levels as $level){
                $level_item = [];
                $level_item["id"] = $level["id"];
                $level_item["text"] = $level["name"];
                array_push($level_array,$level_item);

            }
        }
        return $level_array;
    }
    function supcategory(SupCategoryBusi $busi){
        return response()->packet($busi->response());
    }

    function getMutilQuota(QuotaMutilBusi $busi){
        return response()->packet($busi->response());
    }
    function getQuota(QuotaBusi $busi){
        return response()->packet($busi->response());
    }
    function getSubCategoryDetail(SubCategoryBusi $busi){
        return response()->packet($busi->response());
    }
    function getStandardOne(StandardBusi $busi){
        return response()->packet($busi->response());
    }
    function companyList(CompanyListBusi $busi){
        return response()->packet($busi->response());
    }
    function consultAdd(ConsultAddBusi $busi){
        return response()->packet($busi->response());
    }
    function captchaconsult(ConsultCaptchaBusi $busi){
        return response()->packet($busi->response());
    }
    function captchareg(RegisterCaptchaBusi $busi){
        return response()->packet($busi->response());
    }
    function captchaforgetpwd(ForgetPwdCaptchaBusi $busi){
        return response()->packet($busi->response());
    }
    function banner(BannerListBusi $busi){
        return response()->packet($busi->response());
    }
    function subcategquotalist(SubCategoryList $busi){
        return response()->packet($busi->response());
    }
    function uploadcompany(UploadCompanyInfoBusi $busi){
        return response()->packet($busi->response());
    }
    function imgupload(ImgUploadBusi $busi){
        return response()->packet($busi->response());
    }
    function companyAdd(CompanyAddBusi $busi){
        return response()->packet($busi->response());
    }
    function consultList(ConsultListBusi $busi){
        return response()->packet($busi->response());
    }
    function newsindex(NewsIndexBusi $busi){
        return response()->packet($busi->response());
    }
    function indexnews(IndexNewsBusi $busi){
        return response()->packet($busi->response());
    }
    function newslist(NewsListBusi $busi){
        return response()->packet($busi->response());
    }
    function newsdetail(NewsDetailBusi $busi){
        return response()->packet($busi->response());
    }
    function hotnewslist(HotNewsListBusi $busi){
        return response()->packet($busi->response());
    }
    function randnewslist(RandNewsListBusi $busi){
        return response()->packet($busi->response());
    }
    function companyInfo(UserInfoBusi $busi){
        return response()->packet($busi->response());
    }
    function distAdd(DistAddBusi $busi){
        return response()->packet($busi->response());
    }
    function companyStaffAdd(CompanyStaffAddBusi $busi){
        return response()->packet($busi->response());
    }
    function companyStaffList(CompanyStaffListBusi $busi){
        return response()->packet($busi->response());
    }
    function companyStaffDel(CompanyStaffDelBusi $busi){
        return response()->packet($busi->response());
    }
    function companyCaseAdd(CompanyCaseAddBusi $busi){
        return response()->packet($busi->response());
    }
    function companyCaseList(CompanyCaseListBusi $busi){
        return response()->packet($busi->response());
    }
    function companyCaseDel(CompanyCaseDelBusi $busi){
        return response()->packet($busi->response());
    }
    function companyStaffGetOne(CompanyStaffGetOneBusi $busi){
        return response()->packet($busi->response());
    }
    function companyCaseGetOne(CompanyCaseGetOneBusi $busi){
        return response()->packet($busi->response());
    }
    function voucherList(VoucherListBusi $busi){
        return response()->packet($busi->response());
    }
    function policyList(PolicyListBusi $busi){
        return response()->packet($busi->response());
    }
    function consultGetOne(ConsultGetOneBusi $busi){
        return response()->packet($busi->response());
    }
    function userCompanyInfoBusi(UserCompanyInfoBusi $busi){
        return response()->packet($busi->response());
    }
    function companyDetail(CompanyDetailBusi $busi){
        return response()->packet($busi->response());
    }
    function getCompanyCases(CompanyCaseBusi $busi){
        return response()->packet($busi->response());
    }
    function getCompanyStaff(CompanyStaffBusi $busi){
        return response()->packet($busi->response());
    }
    function cityIds(CityListBusi $busi){
        return response()->packet($busi->response());
    }
    function thirdUrls(ThridUrlListBusi $busi){
        return response()->packet($busi->response());
    }

}
